package com.zjp.mg.model;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
import org.springframework.data.mongodb.core.mapping.MongoId;

/**
 * 车库
 */

@Getter
@Setter
// db.garage.createIndex({'location': '2dsphere'},{background:true,name:"idx_location"});
//联合索引，可以加速搜索
@CompoundIndex(name = "location_index", def = "{'location': '2dsphere'}")
public class Garage {
    @MongoId(value = FieldType.INT64)
    @Field("_id")
    @Id
    private Long garageId;

    private String garageName;

    private GeoJsonPoint location;

    private String address;


}
